home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / windows / ocx / wave.exe / WAVES3.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-07-18  |  9.1 KB  |  302 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Appearance      =   0  'Flat
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Wave VBX Start/End Sample"
  6.    ClientHeight    =   3135
  7.    ClientLeft      =   1650
  8.    ClientTop       =   1920
  9.    ClientWidth     =   4095
  10.    BeginProperty Font 
  11.       name            =   "MS Sans Serif"
  12.       charset         =   1
  13.       weight          =   700
  14.       size            =   8.25
  15.       underline       =   0   'False
  16.       italic          =   0   'False
  17.       strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H80000008&
  20.    Height          =   3540
  21.    Left            =   1590
  22.    LinkTopic       =   "Form1"
  23.    ScaleHeight     =   3135
  24.    ScaleWidth      =   4095
  25.    Top             =   1575
  26.    Width           =   4215
  27.    Begin VB.Timer Timer1 
  28.       Interval        =   50
  29.       Left            =   2880
  30.       Top             =   0
  31.    End
  32.    Begin VB.TextBox txtPosition 
  33.       Appearance      =   0  'Flat
  34.       BeginProperty Font 
  35.          name            =   "MS Sans Serif"
  36.          charset         =   0
  37.          weight          =   400
  38.          size            =   8.25
  39.          underline       =   0   'False
  40.          italic          =   0   'False
  41.          strikethrough   =   0   'False
  42.       EndProperty
  43.       Height          =   285
  44.       Left            =   240
  45.       TabIndex        =   9
  46.       Top             =   1200
  47.       Width           =   3615
  48.    End
  49.    Begin VB.TextBox txtEnd 
  50.       Appearance      =   0  'Flat
  51.       BeginProperty Font 
  52.          name            =   "MS Sans Serif"
  53.          charset         =   0
  54.          weight          =   400
  55.          size            =   8.25
  56.          underline       =   0   'False
  57.          italic          =   0   'False
  58.          strikethrough   =   0   'False
  59.       EndProperty
  60.       Height          =   285
  61.       Left            =   2160
  62.       TabIndex        =   7
  63.       Top             =   1800
  64.       Width           =   1695
  65.    End
  66.    Begin VB.TextBox txtStart 
  67.       Appearance      =   0  'Flat
  68.       BeginProperty Font 
  69.          name            =   "MS Sans Serif"
  70.          charset         =   0
  71.          weight          =   400
  72.          size            =   8.25
  73.          underline       =   0   'False
  74.          italic          =   0   'False
  75.          strikethrough   =   0   'False
  76.       EndProperty
  77.       Height          =   285
  78.       Left            =   240
  79.       TabIndex        =   5
  80.       Top             =   1800
  81.       Width           =   1695
  82.    End
  83.    Begin VB.TextBox txtFilename 
  84.       Appearance      =   0  'Flat
  85.       BeginProperty Font 
  86.          name            =   "MS Sans Serif"
  87.          charset         =   0
  88.          weight          =   400
  89.          size            =   8.25
  90.          underline       =   0   'False
  91.          italic          =   0   'False
  92.          strikethrough   =   0   'False
  93.       EndProperty
  94.       Height          =   285
  95.       Left            =   240
  96.       TabIndex        =   2
  97.       Text            =   "C:\WINDOWS\RINGOUT.WAV"
  98.       Top             =   480
  99.       Width           =   3615
  100.    End
  101.    Begin VB.CommandButton btnStop 
  102.       Appearance      =   0  'Flat
  103.       BackColor       =   &H80000005&
  104.       Caption         =   "Stop"
  105.       BeginProperty Font 
  106.          name            =   "MS Sans Serif"
  107.          charset         =   0
  108.          weight          =   400
  109.          size            =   8.25
  110.          underline       =   0   'False
  111.          italic          =   0   'False
  112.          strikethrough   =   0   'False
  113.       EndProperty
  114.       Height          =   375
  115.       Left            =   2160
  116.       TabIndex        =   1
  117.       Top             =   2520
  118.       Width           =   1695
  119.    End
  120.    Begin VB.CommandButton btnPlay 
  121.       Appearance      =   0  'Flat
  122.       BackColor       =   &H80000005&
  123.       Caption         =   "Play"
  124.       BeginProperty Font 
  125.          name            =   "MS Sans Serif"
  126.          charset         =   0
  127.          weight          =   400
  128.          size            =   8.25
  129.          underline       =   0   'False
  130.          italic          =   0   'False
  131.          strikethrough   =   0   'False
  132.       EndProperty
  133.       Height          =   375
  134.       Left            =   240
  135.       TabIndex        =   0
  136.       Top             =   2520
  137.       Width           =   1695
  138.    End
  139.    Begin WaveLib.Wave Wave1 
  140.       Left            =   3360
  141.       Top             =   0
  142.       _version        =   65537
  143.       _extentx        =   847
  144.       _extenty        =   847
  145.       _stockprops     =   64
  146.       exclusive       =   0   'False
  147.       filename        =   ""
  148.       filelength      =   0
  149.       loop            =   0   'False
  150.       playend         =   -1
  151.       playstart       =   -1
  152.    End
  153.    Begin VB.Label Label4 
  154.       Appearance      =   0  'Flat
  155.       BackColor       =   &H00C0C0C0&
  156.       BackStyle       =   0  'Transparent
  157.       Caption         =   "Position:"
  158.       BeginProperty Font 
  159.          name            =   "MS Sans Serif"
  160.          charset         =   0
  161.          weight          =   400
  162.          size            =   8.25
  163.          underline       =   0   'False
  164.          italic          =   0   'False
  165.          strikethrough   =   0   'False
  166.       EndProperty
  167.       ForeColor       =   &H80000008&
  168.       Height          =   255
  169.       Left            =   240
  170.       TabIndex        =   8
  171.       Top             =   960
  172.       Width           =   1215
  173.    End
  174.    Begin VB.Label Label3 
  175.       Appearance      =   0  'Flat
  176.       BackColor       =   &H00C0C0C0&
  177.       BackStyle       =   0  'Transparent
  178.       Caption         =   "End:"
  179.       BeginProperty Font 
  180.          name            =   "MS Sans Serif"
  181.          charset         =   0
  182.          weight          =   400
  183.          size            =   8.25
  184.          underline       =   0   'False
  185.          italic          =   0   'False
  186.          strikethrough   =   0   'False
  187.       EndProperty
  188.       ForeColor       =   &H80000008&
  189.       Height          =   255
  190.       Left            =   2160
  191.       TabIndex        =   6
  192.       Top             =   1560
  193.       Width           =   1215
  194.    End
  195.    Begin VB.Label Label2 
  196.       Appearance      =   0  'Flat
  197.       BackColor       =   &H00C0C0C0&
  198.       BackStyle       =   0  'Transparent
  199.       Caption         =   "Start:"
  200.       BeginProperty Font 
  201.          name            =   "MS Sans Serif"
  202.          charset         =   0
  203.          weight          =   400
  204.          size            =   8.25
  205.          underline       =   0   'False
  206.          italic          =   0   'False
  207.          strikethrough   =   0   'False
  208.       EndProperty
  209.       ForeColor       =   &H80000008&
  210.       Height          =   255
  211.       Left            =   240
  212.       TabIndex        =   4
  213.       Top             =   1560
  214.       Width           =   1215
  215.    End
  216.    Begin VB.Label Label1 
  217.       Appearance      =   0  'Flat
  218.       BackColor       =   &H00C0C0C0&
  219.       BackStyle       =   0  'Transparent
  220.       Caption         =   "Filename:"
  221.       BeginProperty Font 
  222.          name            =   "MS Sans Serif"
  223.          charset         =   0
  224.          weight          =   400
  225.          size            =   8.25
  226.          underline       =   0   'False
  227.          italic          =   0   'False
  228.          strikethrough   =   0   'False
  229.       EndProperty
  230.       ForeColor       =   &H80000008&
  231.       Height          =   255
  232.       Left            =   240
  233.       TabIndex        =   3
  234.       Top             =   240
  235.       Width           =   1935
  236.    End
  237. Attribute VB_Name = "Form1"
  238. Attribute VB_Creatable = False
  239. Attribute VB_Exposed = False
  240. Option Explicit
  241. Dim fChanged As Integer ' flag: has filename changed?
  242. Private Sub btnPlay_Click()
  243.     ' make sure the filename is up to date
  244.     SetFilename
  245.     ' check for start field
  246.     If Trim(txtStart) <> "" Then
  247.         Wave1.PlayStart = Val(txtStart)
  248.     Else
  249.         Wave1.PlayStart = -1
  250.     End If
  251.     ' check for end field
  252.     If Trim(txtEnd) <> "" Then
  253.         Wave1.PlayEnd = Val(txtEnd)
  254.     Else
  255.         Wave1.PlayEnd = -1
  256.     End If
  257.     ' play the file
  258.     Wave1.Action = 1
  259.     EnableButtons
  260. End Sub
  261. Private Sub btnStop_Click()
  262.     ' stop playing
  263.     Wave1.Action = 4
  264.     ' update buttons
  265.     EnableButtons
  266. End Sub
  267. Private Sub EnableButtons()
  268.     Select Case Wave1.Status
  269.         Case 1: ' playing
  270.             btnStop.Enabled = True
  271.         Case 2: ' paused
  272.             btnStop.Enabled = True
  273.         Case 4: ' stopped
  274.             btnStop.Enabled = False
  275.     End Select
  276. End Sub
  277. Private Sub Form_Load()
  278.     fChanged = True
  279.     EnableButtons
  280. End Sub
  281. Private Sub SetFilename()
  282.     ' if the filename has changed, tell Wave VBX
  283.     If fChanged Then
  284.         ' changed no more
  285.         fChanged = False
  286.         Wave1.filename = txtFilename
  287.     End If
  288. End Sub
  289. Private Sub Timer1_Timer()
  290.     If Wave1.Position = -1 Then
  291.         txtPosition = ""
  292.     Else
  293.         txtPosition = Format(Wave1.Position / 1000, "0.000") & " seconds"
  294.     End If
  295. End Sub
  296. Private Sub txtFilename_Change()
  297.     fChanged = True
  298. End Sub
  299. Private Sub Wave1_PlayDone()
  300.     EnableButtons
  301. End Sub
  302.